<template>
  <div>
    <el-form label-width="100px">
      <el-form-item label="权限名称">
        <el-input v-model="formData.name" />
      </el-form-item>
      <el-form-item label="权限标识">
        <el-input v-model="formData.code" />
      </el-form-item>
      <el-form-item label="权限描述">
        <el-input v-model="formData.description" />
      </el-form-item>
      <el-form-item label="权限启用">
        <el-switch
          v-model="formData.enVisible"
          active-text="启用"
          active-value="1"
          inactive-text="不启用"
          inactive-value="0"
        />
      </el-form-item>
      <el-form-item>
        <el-button @click="$emit('update:dialogTableVisible', false)">取消</el-button>
        <el-button type="primary" @click="addPermission">确定</el-button>
      </el-form-item>
    </el-form>

  </div>
</template>

<script>
import { addPermission } from '@/api/permission'

export default {
  name: 'VueAdminTemplateMasterDialog',
  props: {
    dialogTableVisible: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      formData: {
        name: '', // 名称
        code: '', // 权限标识
        description: '', // 描述
        enVisible: '0', // 开启
        pid: '', // 添加到哪个节点下
        type: '' // 类型
      }
    }
  },

  methods: {
    addPermission() {
      addPermission(this.formData)
      this.$emit('success')
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
